//
//  MainVC_Work_Button.m
//  liBaQiang
//
//  Created by 奇林刘 on 2018/10/9.
//  Copyright © 2018年 liu. All rights reserved.
//

#import "MainVC_Work_Button.h"

@interface MainVC_Work_Button ()

@property (nonatomic ,strong) UIImageView *logoImageView;
@property (nonatomic, strong) UILabel *title;

@end

@implementation MainVC_Work_Button {
    NSString *_imageName;
    NSString *_titleString;
}

- (instancetype)initWithImageName:(NSString *)imageName title:(NSString *)title {
    _imageName = imageName;
    _titleString = title;
    self = [super init];
    return self;
}

- (void)configSelf {
    [self mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.equalTo(@(RPX(57)));
    }];
}

- (void)allocateComponents {
    [self allocateLogoImageView];
    [self allocateTitle];
}

- (void)configComponents {
    [self configLogoImageView];
    [self configTitle];
}

#pragma mark - usedMethods
- (void)allocateLogoImageView {
    self.fp_addSubview(self.logoImageView=[[UIImageView alloc]init]);
    [self.logoImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.equalTo(self);
        make.height.equalTo(@(RPX(29)));
    }];
}

- (void)allocateTitle {
    self.fp_addSubview(self.title=[[UILabel alloc]init]);
    [self.title mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self);
        make.centerX.equalTo(self);
    }];
}

- (void)configLogoImageView {
    self.logoImageView.fp_contentMode(UIViewContentModeScaleAspectFit);
    [self.logoImageView setImage:[UIImage imageNamed:_imageName]];
}

- (void)configTitle {
    self.title.fp_font(RPXFont(12))
        .fp_textColor([UIColor blackColor])
        .fp_text(_titleString);
}



@end
